<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>微信公众号支付</title>
    <link href="/static/css/register.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script src="/static/js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="https://res2.wx.qq.com/open/js/jweixin-1.4.0.js"></script>

    <style>
        .login-bg {
            background: url(/static/images/bg.png) no-repeat center;
            background-size: cover;
            overflow: hidden;
            text-align: center;
        }
    </style>
</head>
<body class="login-bg">
<h3 style="font-size: 40px;color: greenyellow;padding-top: 40px;">正在发起支付,请稍后...</h3><br>
</body>
<script type="text/javascript" th:inline="javascript">
    var jsapi_app_id = [[${jsapi_app_id}]];
    var jsapi_timeStamp = [[${jsapi_timeStamp}]];
    var jsapi_nonceStr = [[${jsapi_nonceStr}]];
    var jsapi_package = [[${jsapi_package}]];
    var jsapi_signType = [[${jsapi_signType}]];
    var jsapi_paySign = [[${jsapi_paySign}]];
</script>
<script>
    $(function () {
        if (typeof WeixinJSBridge == "undefined") {
            if (document.addEventListener) {
                document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
            } else if (document.attachEvent) {
                document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
                document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
            }
        } else {
            onBridgeReady();
        }
    });

    function onBridgeReady() {
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest', {
                "appId": jsapi_app_id, //公众号名称，由商户传入
                "timeStamp": jsapi_timeStamp, //时间戳，自1970年以来的秒数
                "nonceStr": jsapi_nonceStr, //随机串
                "package": jsapi_package,
                "signType": jsapi_signType,
                "paySign": jsapi_paySign //微信签名
            },
            function (res) {
                if (res.err_msg == "get_brand_wcpay_request:ok") {
                    alert('支付完成');
                }
            }
        )
    }

</script>
</html>